import complex_query from '@feidao/web/atom/nodejs/db/complex-query';

import { spaceid, systemid } from './atom/config';

interface Message {
	filter: {
		num: number;
	};
	page_size: number;
	page_no: number;
	asc: string;
	desc: string;
}

/**
 * @description where相等查询
 * @param {
		filter: {
			num: 13
		},
		page_size: 20,
		page_no: 1,
		asc: 'factory_no'
	}
 */

export default async function atom(msg: Message, action_id: string, session_id: string) {
	const cquery = complex_query(action_id, spaceid, systemid);

	cquery.add_field('msz_test1', '_id', '_id')
		.add_field('msz_test1', 'name', 'name')
		.add_field('msz_test1', 'num', 'num')
		.where_gte('msz_test1', 'num', msg.filter.num);

	const res = await cquery.exec();
	return res;
}
